var F_Overview_Entrance = {
    _init: function () {
        console.log("F_Overview_Entrance")
        if (B_Login._checkUpdate(), M_HeadFoot._headShow(1), "demo" != M_Init._controller && B_User._isDemoUser())
            B_Login._openLogin("background");
        else {
            switch (M_Init._clean(), $("#headerTop").html(""), M_Init._controller) {
                case"demo":
                    console.log("我是 demo")
                    $("#gameDropChoose").show(), B_Pop._init("close"), M_Init._api.innerOperationEvaluate = "demoInnerOperationEvaluate";
                    break;
                default:
                    console.log("我不是 demo")
                    M_Init._api.innerOperationEvaluate = "innerOperationEvaluate"
            }

            var a = B_Common._getUrl("query");


            a.g && (M_Init._gameId = a.g), M_Common._getOrderGame("overview", a.g, "1-1-1")
        }
    }
}, F_Overview_Info = {
    // 目录跳转链接
    _htmlInit: function () {
        //页面布局
        console.log("页面布局在这里");

        var a = "";
        a += '            <div class="data-kh-quota blockpart col-lg-4 col-md-9 col-sm-12 col-xs-12">         ' +
            '       <h3 class="part-title">考核指标</h3>                <div class="boxshadow" id="bs_index"></div>      ' +
            '      </div>            <div class="data-jd-quota blockpart col-lg-2 col-md-3 col-sm-12 col-xs-12">        ' +
            '        <h3 class="part-title">阶段性指标</h3>                <div class="boxshadow" id="bs_step"></div>   ' +
            '         </div>            <div class="data-intelligent-forecast blockpart col-lg-3 col-md-12 col-sm-12 col-xs-12">        ' +
            '        <h3 class="part-title">智能预测</h3>                <div class="boxshadow" id="bs_intelligent"></div>        ' +
            '    </div>            <div class="data-unusual-watch blockpart col-lg-3 col-md-12 col-sm-12 col-xs-12">         ' +
            '       <h3 class="part-title">异常数据监测</h3>                <div class="boxshadow" id="bs_trouble"></div>      ' +
            '      </div>            <div class="blockpart data-keypoint-quota col-lg-12 col-md-12 col-sm-12 col-xs-12">        ' +
            '        <h3 class="part-title">关键指标分析</h3>                <ul class="tab-change">         ' +
            '           <li class="selected">付费金额</li>                    <li>活跃人数</li>             ' +
            '       <li>新增人数</li>                </ul>                <div class="boxshadow">           ' +
            '         <div id="bs_chart_info"></div>         ' +
            '           <div class="graph-part"><div id="bs_chart" style="width:100%;height:100%"></div></div>       ' +
            '         </div>      ' +
            '      </div>',
            $("#ct_main_area").html(a),
            $(".data-keypoint-quota ul li").each(function (a) {
            $(this).click(function () {
                console.log('333333333333echart',!$(this).hasClass("selected"))

                if (!$(this).hasClass("selected")){
                    switch ($(this).addClass("selected").siblings().removeClass("selected"), a + "") {
                        case"0":
                            F_Overview_Info._chartData("pay");
                            break;
                        case"1":
                            F_Overview_Info._chartData("active");
                            break;
                        case"2":
                            F_Overview_Info._chartData("additional")
                    }
                }

            })
        })
    }, _htmlStep: function (a) {
        return "            <ul>            " +
            "<li> " +
            "<span>CAC</span>" +
            "<h3>" + a.cac + "</h3>" +
            "</li> " +
            "<li>" +
            "<span>LTV</span> " +
            " <h3>" + a.ltv + "</h3>   " +
            "</li>  " +
            "<li> " +
            "<span>ROI</span>" +
            "<h3>" + a.roi + "</h3> " +
            " </li> " +
            "</ul>"
    }, _htmlIntelligent: function (a) {
        var t = 0, e = 0, n = 0;
        return "-" != a.potential_lost_rate && (t = a.potential_lost_rate), "-" != a.pay_rate && (e = a.pay_rate), "-" != a.potential_pay_rate && (n = a.potential_pay_rate), " " +
        "           <div>                <b>" + a.pay_num + '</b>     ' +
        '           <span>在未来几日有付费意愿的用户</span>          ' +
        '      <div class="des">              ' +
        '      <span> 昨日活跃用户中，<b class="orange-text">已付费用户</b>占' + a.pay_rate + '%，<b class="yellow-text">有付费意愿用户</b>占' + a.potential_pay_rate + '%</span>        ' +
        '        </div>                <div class="rate-part">                    <span class="rate-orange" style="width: ' + e + '%"></span>    ' +
        '                <span class="rate-yellow" style="width: ' + n + '%"></span>                </div>            </div>            <div>       ' +
        '         <b>' + a.potential_lost_num + '</b>                <span>在未来几日有流失风险的用户</span>                <div class="des">         ' +
        '           <span> 昨日活跃用户中，<b class="green-text">有流失风险的用户</b>占' + a.potential_lost_rate + '%<span>         ' +
        '       </div>                <div class="rate-part">                    <span class="rate-green1" style="width: ' + t + '%"></span>       ' +
        '         </div>      ' +
        '      </div>'
    }, _htmlTrouble: function (a) {
        console.log("_htmlTrouble a is:", a);

        var t = "";
        if (t += '            <div class="top">       ' +
                '         <span>监测到<b>' + a.length + "</b>项异常数据</span>     " +
                "       </div>      " +
                "      <ul>", a.length > 0)

            for (var e = "", n = 0; n < a.length; n++) {
                switch (a[n].trend) {
                    case"down":
                        e = "";
                        break;
                    case"up":
                        e = ' class="positive"'
                }
        t += "  <li" + e + ' data-t="' + a[n].link + '"> ' +
                '<i class="circle"></i>  ' +
                '<span>' + a[n].title + " <b>" + a[n].value + '</b></span>  ' +
                '<span><i class="triangle"></i><b>'
                + a[n].fluctuation + "</b></span>" +
                "</li>"
        }

        return t += "</ul>"
    }, _urlTrouble: function (a) {
        var t = "javascript:void(0)", e = "";
        switch (a) {
            case"游戏概览-关键指标":
                e = "insideKeypoint";
                break;
            case"玩家分析-新增玩家":
                e = "insideAdditional";
                break;
            case"玩家分析-活跃玩家":
                e = "insideActivity";
                break;
            case"玩家分析-留存玩家":
                e = "insideSave";
                break;
            case"玩家分析-付费玩家":
                e = "insidePay";
                break;
            case"玩家分析-流失玩家":
                e = "insideLost";
                break;
            case"玩家分析-玩家习惯":
                e = "insideHabit";
                break;
            case"留存分析":
                e = "insideRetentioncount";
                break;
            case"付费分析-付费数据":
                e = "insidePayData";
                break;
            case"付费分析-付费渗透":
                e = "insidePayOsmosis";
                break;
            case"付费分析-付费转化":
                e = "insidePayConversion";
                break;
            case"付费分析-付费习惯":
                e = "insidePayHabit";
                break;
            case"流失分析-流失统计":
                e = "insideLostAnalysis";
                break;
            case"流失分析-流失漏斗":
                e = "insideLostFunnel";
                break;
            case"渠道分析-质量指标分析":
                e = "insideChannelQuality";
                break;
            case"渠道分析-收入指标分析":
                e = "insideChannelEarn"
        }
        return "" != e && (t = B_Jump._getUrl(e)), t
    }, _getInfo: function () {
        console.log("向网页写内容");

        $("#contentPart").removeClass("insidelog-part").addClass("data-ss-part"), F_Overview_Info._htmlInit();
        var a = $("#bs_index"), t = $("#bs_step"), e = $("#bs_intelligent"), n = $("#bs_trouble"), s = $("#bs_chart"),
            i = {};
        i.game_id = M_Init._gameId, i = B_Common._postData(i),
            console.log("i is:", i)
        B_Port._ajax(M_Init._api.innerOperationEvaluate, "post", !0, i, function () {
            a.html(B_Pre._loading()), t.html(B_Pre._loading()), e.html(B_Pre._loading()), n.html(B_Pre._loading()), s.html(B_Pre._loading())
        }, function () {
            a.html(""), t.html(""), e.html(""), n.html(""), s.html("")
        }, function (i, l) {
            console.log("innerOperationEvaluate i is:", i);
            console.log("innerOperationEvaluate l is:", l);

            i && i.base && !B_Common._checkObjectIsEmpty(i.base) ? (a.html(F_Overview_Info._htmlIndex(i.base)),
                t.html(F_Overview_Info._htmlStep(i.base)), e.html(F_Overview_Info._htmlIntelligent(i.base)),
                $("#bs_index ul li").each(function (a) {
                    //数据跳转链接，暂时屏蔽；
                    console.log("/数据跳转链接，暂时屏蔽")
                    $(this).click(function () {
                        var t = "";
                        switch (a + "") {
                            case"0":
                                t = "insidePayData";
                                break;
                            case"1":
                                t = "insidePay";
                                break;
                            case"2":
                                t = "insideAdditional";
                                break;
                            case"3":
                                t = "insidePayData";
                                break;
                            case"4":
                                t = "insidePay";
                                break;
                            case"5":
                                t = "insideActivity"
                        }
                        console.log("/数据跳转链接，暂时屏蔽")
                        //B_Jump._go("base", B_Jump._getUrl(t))
                    })
                })) : (a.html(B_Pre._empty("暂无数据")), t.html(B_Pre._empty("暂无数据")), e.html(B_Pre._empty("暂无数据"))),

                i && i.abnormal && i.abnormal.data ? (n.html(F_Overview_Info._htmlTrouble(i.abnormal.data)), $("#bs_trouble ul li").each(function () {
                    $(this).click(function () {
                        console.log("/数据跳转链接，暂时屏蔽")
                        //B_Jump._go("base", F_Overview_Info._urlTrouble($(this).attr("data-t")))
                    })
                })) : (n.html(B_Pre._empty("暂无数据")), s.html(B_Pre._empty("暂无数据"))),
            i && i.analysis && i.analysis.axis_date && i.analysis.axis_date.length > 0 && (M_Init._dataCache.analysis = i.analysis, F_Overview_Info._chartData("pay"))
        }, function (i, l, _) {
            a.html(B_Pre._empty(l)), t.html(B_Pre._empty(l)), e.html(B_Pre._empty(l)), n.html(B_Pre._empty(l)), s.html(B_Pre._empty(l))
        })
    }, _countIndex: function (a, t, e, n) {
        var s = {trend: "", class: ""};
        switch (e) {
            case"up":
                s.trend = "&uarr;", s.class = "up";
                break;
            case"down":
                s.trend = "&darr;", s.class = "down"
        }
        return "-" != n && (n += "%"), "            <li>                <p>" + a + "</p>                <h3>" + t + '</h3>                <span>较前日 </span><b class="' + s.class + '">' + s.trend + "</b><b>" + n + "</b>            </li>"
    }, _htmlIndex: function (a) {
        console.log("a is:", a);

        var t = "<ul>";
        return t += F_Overview_Info._countIndex("昨日收入", a.pay_amount, a.pay_amount_trend, a.pay_amount_rate),
            t += F_Overview_Info._countIndex("昨日付费用户数", a.pay_num, a.last_pay_num_trend, a.last_pay_num_rate),
            t += F_Overview_Info._countIndex("昨日新增玩家数", a.newlogin_num, a.last_newlogin_num_trend, a.last_newlogin_num_rate),
            t += F_Overview_Info._countIndex("累计收入", a.total_pay_amount, a.last_total_pay_amount_trend, a.last_total_pay_amount_rate),
            t += F_Overview_Info._countIndex("累计付费用户数", a.total_pay_num, a.last_total_pay_num_trend, a.last_total_pay_num_rate),
            t += F_Overview_Info._countIndex("昨日活跃人数", a.login_num, a.last_login_num_trend, a.last_login_num_rate), t += "</ul>"

    }, _chartData: function (a) {
        console.log(" _chartData a is:", a);

        if (M_Init._dataCache.analysis) {
            var t = M_Init._dataCache.analysis,
                e = {
                    x_axis: M_Init._dataCache.analysis.axis_date,
                    y_axis: []
                },
                n = 50,
                s = "",
                i = "人";

            console.log("echart a is:",a)
            console.log("echart t is:",t);
            switch (a) {
                case"pay":
                    t.axis_pay_amount && e.y_axis.push({
                        name: "付费金额",
                        data: t.axis_pay_amount
                    }),
                        s = "<span>AVG：</span><span>日均付费金额<b>" + t.avg_pay_amount + "</b></span> <span>SUM：</span><span>付费金额总数<b>" + t.sum_pay_amount + "</b></span>", i = "元";
                    break;
                case"active":
                    t.axis_login_num && e.y_axis.push({
                        name: "活跃人数",
                        data: t.axis_login_num
                    }), s = "<span>AVG：</span><span>日均活跃用户<b>" + t.avg_login_num + "</b></span> <span>SUM：</span><span>活跃用户总数<b>" + t.sum_login_num + "</b></span>";
                    break;
                case"additional":
                    t.axis_newlogin_num && e.y_axis.push({
                        name: "新增人数",
                        data: t.axis_newlogin_num
                    }), s = "<span>AVG：</span><span>日均新增人数<b>" + t.avg_newlogin_num + "</b></span> <span>SUM：</span><span>新增人数总数<b>" + t.sum_newlogin_num + "</b></span>"
            }
            e.y_axis.length > 0 && (e.xFormatDate = !0, e.yFormat = "", $("#bs_chart_info").html(s), e.tooltip = {
                num: e.y_axis.length,
                unit: i
            }, M_Inside_Chart._chartData(n, "bs_chart", e))
        }
    }
};